// 地图初始化方法，及配置

let config = {
	zoom: 16.5,
	minZoom: 11,
	maxZoom: 18,
	mapURL: window.$mapURL || "http://192.168.0.253:8081/geoserver/map/wms",
	layer: window.$layer || "map:geotools_coverage",
	Lng: 117.96563,
	Lat: 36.63077,
};

export default function initMap(id) {
	// id 地图容器
	let map = L.map(id, { editable: true }).setView([config.Lat, config.Lng], config.zoom);
	L.tileLayer
		.wms(config.mapURL, {
			layers: config.layer,
			format: "image/png",
			transparent: true,
			minZoom: config.minZoom,
			maxZoom: config.maxZoom,
		})
		.addTo(map);
	return map;
}
